UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hvwOL6s8CYqaEIl5yiL5iguRYAR9jZAB8D/RUesd+es='
WHERE
key_id = '82d8d1b1f8b99401400fa3f58e0efb85c7db85eb08cf0cab63aae3ed551d344f'
AND (
token = 'hvwOL6s8CYqaEIl5yiL5iguRYAR9jZAB8D/RUesd+es='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)