UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Y5OijYOeFDrgYrCZLBeSBSRRrs7cbaioDEw+o7KGjCk='
WHERE
key_id = 'd21b564bae757dcaeb6005f386b9cdf61c8d486cafed8b1f1b57e5bde0750090'
AND (
token = 'Y5OijYOeFDrgYrCZLBeSBSRRrs7cbaioDEw+o7KGjCk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)