UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XifK3hWxoCSqFoVgt3bz4B13BqSeLR7y9rJvoR5S9t4='
WHERE
key_id = 'f715f7da3a472ba80c8a395f625036ef65d7e9ea98e90ca9077970693745a7cb'
AND (
token = 'XifK3hWxoCSqFoVgt3bz4B13BqSeLR7y9rJvoR5S9t4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)