UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '17PS+6GpsMw3oEMLlwKKddxSXfbaZCE8ae8KMuzw6nk='
WHERE
key_id = '39ea6435083b2b84818374e4999006a8aff50dab0db14cb537cbe559c31e0637'
AND (
token = '17PS+6GpsMw3oEMLlwKKddxSXfbaZCE8ae8KMuzw6nk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)