UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gwbfBNr8G4SD2c1zRqZqYP0V0VhspWUx+19Wfx3e/i8=' 
WHERE 
  key_id = 'c3254017493fa43e3b45d3465476c470f99b9fe74eb8e930b464fb3d002bf9e7' 
  AND (
    token = 'gwbfBNr8G4SD2c1zRqZqYP0V0VhspWUx+19Wfx3e/i8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053