UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A7JLB8OIyrTQJN1EmIOQXvJ24RLaLH9uNxO2leZrzIo='
WHERE
key_id = '9f381e8a4257111a4474d43d816f65a83c05f5d6f9fb28e6486d754365bca471'
AND (
token = 'A7JLB8OIyrTQJN1EmIOQXvJ24RLaLH9uNxO2leZrzIo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)