UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iKmgpD4gSZ1LqskcHey6wmps/Ll6qxODbXf5xDNnSCw='
WHERE
key_id = '8ba90398319e1fb4201335bd544cccf0fa9eddea76b5d73866d32feed5d6eff7'
AND (
token = 'iKmgpD4gSZ1LqskcHey6wmps/Ll6qxODbXf5xDNnSCw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)