UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XqiK+qGtv4A69IAiXbVmAdFYrGzNcIfJtDHKKMNAMeI=' 
WHERE 
  key_id = 'c1e79f057108fb31b76d91a6595544c288141f1d7e69f4030e48d468f8515f63' 
  AND (
    token = 'XqiK+qGtv4A69IAiXbVmAdFYrGzNcIfJtDHKKMNAMeI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020