UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g6bA0pmp7q0CfY+HPihxCuBJggGF7G4X3nbD4wDuQXo=' 
WHERE 
  key_id = '85827c0752ac95f120f614c0178a9286ddafaf040b0028bf0b9cd897dec8d3f2' 
  AND (
    token = 'g6bA0pmp7q0CfY+HPihxCuBJggGF7G4X3nbD4wDuQXo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036