UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BqPPvQAVlD7R47bol9ozFhZbNzIR0h33i++lJ7NhMWw='
WHERE
key_id = '4d804770fec3359e98ea84bff229c2b56549a1681b86342703ccfd9696ea2571'
AND (
token = 'BqPPvQAVlD7R47bol9ozFhZbNzIR0h33i++lJ7NhMWw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)