UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8uXn0H6x+dwnYFegACM/AQ/7sNhkxXEEyJC1nGwdkEA='
WHERE
key_id = 'd8dea587d86c33ee759a66e0e4b66479808546c131674de34039ad71d6d01609'
AND (
token = '8uXn0H6x+dwnYFegACM/AQ/7sNhkxXEEyJC1nGwdkEA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)