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