UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lSWQtePyP6qB7L4yLutt+rAFLD337nic4AS74XtFjHg=' 
WHERE 
  key_id = '6ee33a213a71340a2d014c7932917340766c337b7676324c83047fe31f696700' 
  AND (
    token = 'lSWQtePyP6qB7L4yLutt+rAFLD337nic4AS74XtFjHg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018