UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'on6EVAgZA9di+r5Pe1Q90NBNFl1MSWTjfpoS31T3Uh8='
WHERE
key_id = '076f05dc0e9f3e9bde4a226c448833be97a30cb0441ee053429487a5b331065a'
AND (
token = 'on6EVAgZA9di+r5Pe1Q90NBNFl1MSWTjfpoS31T3Uh8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)