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