UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'i1OVh8oNZcdo82MVFBlW8FGt52+vgIaPbCZSjC17PqE='
WHERE
key_id = 'f56f496ee4f7311fe08f559e16c63f379d790c0dc413a7fb10888b4b0424131d'
AND (
token = 'i1OVh8oNZcdo82MVFBlW8FGt52+vgIaPbCZSjC17PqE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)