UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1wnsbmwPKIRIjFPSvxylvsnl4+yo/5FdXmdLNqHMhJ4='
WHERE
key_id = 'f20f844baf33e84c8dee0a488c1c2c160e4c099484ecdec8a9c45c468546d17d'
AND (
token = '1wnsbmwPKIRIjFPSvxylvsnl4+yo/5FdXmdLNqHMhJ4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)