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

Query time 0.00019