UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AqHNhITzX7Kj9gxrDg2kE6wnqxESHhjlqAWdFMCfYCY='
WHERE
key_id = '8ab4f48fdaf70cd0e6c17fa32af939563a9739cf9ddea34807cd902f2212018c'
AND (
token = 'AqHNhITzX7Kj9gxrDg2kE6wnqxESHhjlqAWdFMCfYCY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)