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