UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XHj/Gup/JwVblC+RzQkI/bS6if6YXmWocBIbAfQZkCE='
WHERE
key_id = 'cae918f44c15880650b3e50a64f2e89d0e0582a631833a4024a0798511e72b2f'
AND (
token = 'XHj/Gup/JwVblC+RzQkI/bS6if6YXmWocBIbAfQZkCE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)