UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fnajDtbXO9j2P72kL36TXIoV/7zAN70FMq28YEhNN08='
WHERE
key_id = 'bb6203017f3b4ca1a84b013196700a586a356341c1d6b76807027e2246671beb'
AND (
token = 'fnajDtbXO9j2P72kL36TXIoV/7zAN70FMq28YEhNN08='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)