UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0OQfjHSwXEl6TWWrKafTudeqUBdzXT3svHiCSiM7zN0='
WHERE
key_id = 'dd8923fe43e467aa3432ab8076cd84fd3c6920fb6e3ab8caf671fc63ee5bf720'
AND (
token = '0OQfjHSwXEl6TWWrKafTudeqUBdzXT3svHiCSiM7zN0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)