UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3CstMsRtc5XuqULLurKxlvLMGNj11HfsYYyEqyif7ws='
WHERE
key_id = 'd6240be2aaad7f2f2f9bc4b34039866c5d04e9ed24a8c82afc53860a78068bd1'
AND (
token = '3CstMsRtc5XuqULLurKxlvLMGNj11HfsYYyEqyif7ws='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)