UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gFgg3p18onB37NfvM6iKZMidbHI0rc0Cjl/Xmxt6LD4='
WHERE
key_id = 'ac5422d2a80ca302ed1e7f9de6b9e8f13707df41d9a0e36e5a6f25bdf567b3ef'
AND (
token = 'gFgg3p18onB37NfvM6iKZMidbHI0rc0Cjl/Xmxt6LD4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)