UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CqDEYLl9fYo1td9hvecfRQ1S9JhTY+gc7pP4zCe/+ac=' 
WHERE 
  key_id = 'c94e414d1a140919d56fcb70b8794a5f941bd00f5a039cd7d1d9b19511741025' 
  AND (
    token = 'CqDEYLl9fYo1td9hvecfRQ1S9JhTY+gc7pP4zCe/+ac=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053