UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RuFmJkSPNtA5Wx8dLSxUTOpX37Er3nVmTOW+5EuplnU=' 
WHERE 
  key_id = 'ea6457033b9fab3bac95159fdf7651a86912a1ae3d0079898ae14d8039fa0366' 
  AND (
    token = 'RuFmJkSPNtA5Wx8dLSxUTOpX37Er3nVmTOW+5EuplnU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032