UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oSG08wv55gOw3QTGoEMfedHm28z2aKnAlRIpRfLdMyw='
WHERE
key_id = 'cd8a5f8942d320a3cd5c65cadaee8f3688f913fad174275d0324657b36b1736f'
AND (
token = 'oSG08wv55gOw3QTGoEMfedHm28z2aKnAlRIpRfLdMyw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)