UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'joTRBbu1JN+JDrK9Yt4D/owJ2f42RKkqXRcMRMKcH+Q=' 
WHERE 
  key_id = 'a3d705482b3f938cc1e8d370ef333985ceb099306bc9fabaf9ee4ad0f1431308' 
  AND (
    token = 'joTRBbu1JN+JDrK9Yt4D/owJ2f42RKkqXRcMRMKcH+Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038