UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rKY8aX0HO7REYQSzf5hT6JdTp3lLSG132Mb1PtoGXY4='
WHERE
key_id = '606799b77e4e8ce2aed7a7b931e3ccb7f710cdbc8ad56c10c1e970db11dcf3e6'
AND (
token = 'rKY8aX0HO7REYQSzf5hT6JdTp3lLSG132Mb1PtoGXY4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)