UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VkXaPSCAK6U17gLnuDAG3TRGlX5dEcMw03IfABMUms0='
WHERE
key_id = '7f003a98853e7eee70c4f0ac92ef7e0d295ab40b1e012668a46e998fdb072227'
AND (
token = 'VkXaPSCAK6U17gLnuDAG3TRGlX5dEcMw03IfABMUms0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)