UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ApNuloBFFXPuRHAu0NGBhT5PJeEhIe8EPTAI00styaE='
WHERE
key_id = 'd7ea63d7ad2fe2f94426b0c740e6702df61e250b8c1f5f0a32c15384a2b6ab2f'
AND (
token = 'ApNuloBFFXPuRHAu0NGBhT5PJeEhIe8EPTAI00styaE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)