UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PJ6fuPGUkIDW2WIaL/yUok/AhOfGwnunU2p97fT4ErI='
WHERE
key_id = 'c3a9466e9f0b50664718eb92fc70995256f23917a93bdcf21f160b2eaa7fe797'
AND (
token = 'PJ6fuPGUkIDW2WIaL/yUok/AhOfGwnunU2p97fT4ErI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)