UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8e2HahqzoIucNnkf8hnW/jl4rlH1jf7TG9Xc4Vwrkww='
WHERE
key_id = 'a68674e41581e509455552ff59333868fcc7b5413bb777079c2a3ea1840c7be4'
AND (
token = '8e2HahqzoIucNnkf8hnW/jl4rlH1jf7TG9Xc4Vwrkww='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)